<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>计数器</title>
</head>
<body>
	<div id="app">
		<p>当前计数：{{num}}</p>
		<button @click="sub">-</button>
		<button @click="add">+</button>
	</div>
	<script src="js/vue.js"></script>
	<script>
		var app1 = new Vue({
			el: "#app",
			data: {
				num: 0
			},
			methods: {
				add: function(){
					this.num++;
				},
				sub: function(){
					this.num--;
				}
			}
		})
	</script>
</body>
</html>